<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="file" name="file1" id='file1' />
    <button id='btn'>提交</button>
</body>
<script>
    var btn = document.getElementById('btn');
    var file1 = document.getElementById('file1');
    btn.onclick = function () {
        var formData = new FormData();
        formData.append('myimage', file1.files[0]);
        fetch('http://localhost:8081/upload', {
            method: 'PUT',
            body: formData,
        }).then(res => res.text()).then((res) => {
            console.log(res);
        })
    }
</script>

</html>